package com.mallcloud.mall.mall.api.entity.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.util.Optional;

@ApiModel(value = "ProAutoLogin", description = "用户登陆（自动注册）对象")
@Data
public class ProAutoLogin {

	@NotBlank(message = "手机号不能为空")
    @ApiModelProperty("手机号")
    private String mobile;
    @ApiModelProperty("登录方式 1-一键授权登录，2-手机验证码登录")
    private String loginType = "1";
	@NotBlank(message = "门店号不能为空")
    @ApiModelProperty("门店号")
    private String storeNo;
	@NotBlank(message = "微信ID不能为空")
    @ApiModelProperty("微信ID")
    private String openid;
    @ApiModelProperty("微信昵称")
    private String wxNickName = "微信用户";
    @ApiModelProperty("微信头像")
    private String wxAvatar;

    @ApiModelProperty("返回id 0-已注册，1-未注册")
	private Integer messageId;
    @ApiModelProperty("返回信息")
    private String message;
    @ApiModelProperty("返回卡号")
    private String cardNo;
    @ApiModelProperty("返回积分")
    private String points;
    @ApiModelProperty("会员所在门店")
    private String rtMkt;
    @ApiModelProperty("会员类型")
    private String cardType;
    @ApiModelProperty("到期日期")
    private String cardMaxDate;

	public boolean isSuccess() {
		return Optional.ofNullable(this.messageId).map(x -> x.equals(0)).orElse(false);
	}
}
